package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.domain.SurveyInvestorEntity;
import com.ly.heart.mapper.SurveyInvestorMapper;
import com.ly.heart.service.ISurveyInvestorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 勘测资方信息Service业务层处理
 * @author wutao
 * @date 2024-05-25
 */
@Service
public class SurveyInvestorServiceImpl extends ServiceImpl<SurveyInvestorMapper, SurveyInvestorEntity> implements ISurveyInvestorService {

    @Resource
    private SurveyInvestorMapper erpSurveyInvestorInfoMapper;

    /**
     * 查询勘测资方信息
     * @param id 勘测资方信息ID
     * @return 勘测资方信息
     */
    @Override
    public SurveyInvestorEntity selectErpSurveyInvestorInfoById (String id) {
        return erpSurveyInvestorInfoMapper.selectErpSurveyInvestorInfoById ( id );
    }

    /**
     * 查询勘测资方信息列表
     * @param erpSurveyInvestorInfo 勘测资方信息
     * @return 勘测资方信息
     */
    @Override
    public List<SurveyInvestorEntity> selectErpSurveyInvestorInfoList (SurveyInvestorEntity erpSurveyInvestorInfo) {
        return erpSurveyInvestorInfoMapper.selectErpSurveyInvestorInfoList ( erpSurveyInvestorInfo );
    }

    /**
     * 新增勘测资方信息
     * @param erpSurveyInvestorInfo 勘测资方信息
     * @return 结果
     */
    @Override
    public int insertErpSurveyInvestorInfo (SurveyInvestorEntity erpSurveyInvestorInfo) {
        String surveyInvestorId = SnowflakeIdWorker.getInstance ().nextStringId ();
        erpSurveyInvestorInfo.setId ( surveyInvestorId );
        erpSurveyInvestorInfo.setCreateTime ( DateUtils.getNowDate () );
        erpSurveyInvestorInfo.setCreateBy ( SecurityUtils.getLoginUser ().getUser ().getUserId ()  );
        return erpSurveyInvestorInfoMapper.insertErpSurveyInvestorInfo ( erpSurveyInvestorInfo );
    }

    /**
     * 修改勘测资方信息
     * @param erpSurveyInvestorInfo 勘测资方信息
     * @return 结果
     */
    @Override
    public int updateErpSurveyInvestorInfo (SurveyInvestorEntity erpSurveyInvestorInfo) {
        erpSurveyInvestorInfo.setUpdateTime ( DateUtils.getNowDate () );
        return erpSurveyInvestorInfoMapper.updateErpSurveyInvestorInfo ( erpSurveyInvestorInfo );
    }

    /**
     * 批量删除勘测资方信息
     * @param ids 需要删除的勘测资方信息ID
     * @return 结果
     */
    @Override
    public int deleteErpSurveyInvestorInfoByIds (String[] ids) {
        return erpSurveyInvestorInfoMapper.deleteErpSurveyInvestorInfoByIds ( ids );
    }

    /**
     * 删除勘测资方信息信息
     * @param id 勘测资方信息ID
     * @return 结果
     */
    @Override
    public int deleteErpSurveyInvestorInfoById (String id) {
        return erpSurveyInvestorInfoMapper.deleteErpSurveyInvestorInfoById ( id );
    }
}
